<?php
if(!isset($_GET['type']))
    die('...');
    

$type = $_GET['type'];
class other{
    public $type;
    public function __construct( $type ){
            $this->type = $type;
    }
    
    
    //路由
    public function doit(){
        switch ($this->type){
            case "readExcle":
                return $this->readExcle( $_GET['path'] );
                break;
        }
    }
    function readExcle($filename,$encode='utf-8'){
        include "../extend/other/PHPExcel.php";
        $objReader = PHPExcel_IOFactory::createReader('Excel5');
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load($filename);
        $objWorksheet = $objPHPExcel->getActiveSheet();
        
        $hightestRow = $objWorksheet->getHighestRow();
        $highestColumn = $objWorksheet->getHighestColumn();
        $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
        $excelData = [];
        for($row = 1; $row<$hightestRow; $row++){
            for($col=0;$col<$highestColumnIndex;$col++){
                $excelData[$row][] = (string)$objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
            }
        }
        exit(json_encode($excelData));
    }
}
$o = new other($type);
return $o->doit();